import pymysql
import base64

#建立数据库对象
conn = pymysql.connect(host="localhost",user="root",password="root",db="workflow",charset='utf8')

#创建游标
cursor = conn.cursor()

# with open('../static/upload/touxiang.png','rb') as f:
# 	data = f.read()
# 	encodestr = base64.b64encode(data)

# 	#入库
# 	sql = "insert into user (img) values ('%s') " % str(encodestr,'utf-8')

# 	cursor.execute(sql)
# 	conn.commit()

# 	cursor.close()
# 	conn.close()

#读取
sql = "select img from user where id = 13"
cursor.execute(sql)
res = cursor.fetchone()

print(res[0])